﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace DataLayer
{
    [KnownType(typeof(Booking))]
    [DataContract(IsReference=true)]
    public class User
    {
        private string _name;
        private string _address;
        private int _userType;
        private List<Booking> _bookings;

        public User(string name, string address, int userType, List<Booking> bookings)
        {
            SetValues(name, address, userType, bookings);
        }

        public User(string name, string address, int userType)
        {
            SetValues(name, address, userType, null);
        }

        public User(string name, string address)
        {
            SetValues(name, address, 0, null);
        }

        public User(string name)
        {
            SetValues(name, "", 0, null);
        }

        public User()
        {
            SetValues("", "", 0, null);
        }

        private void SetValues(string name, string address, int userType, List<Booking> bookings) {
            _name = name;
            _address = address;
            _userType = userType;
            _bookings = bookings;
        }

        [DataMember]
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        [DataMember]
        public string Address
        {
            get { return _address; }
            set { _address = value; }
        }

        [DataMember]
        public int UserType
        {
            get { return _userType; }
            set { _userType = value; }
        }

        [DataMember]
        public List<Booking> Bookings
        {
            get { return _bookings; }
            set { _bookings = value; }
        }

    }
}
